package com.education.seckill.Config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
@Configuration
public class rabbitConfig {

    private  final  static  String  EXCHANGE  = "seckill_exchange";
    private final static  String QUEUE = "seckill_queue";


    //定义发送队列
    @Bean
    public Queue queue(){
        return new Queue(QUEUE);
    }

    @Bean
    public TopicExchange exchange(){
        return new TopicExchange(EXCHANGE) ;
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(exchange()).with("seckill.#");
    }


}
